package edu.android.com;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class undirected extends Activity {

	 @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.undirected);
	        
	        //Menu
	        manageMenu();
	       
	    }
	 
	 	private void manageMenu()
	    {
	        String [] items = new String[]{
	        		"Depth-First",
	        		"Breadth-First",
	        		"Dijkstra",
	        		"Minimum spanning tree"};
	        
	        ArrayAdapter adapter = new ArrayAdapter <String>(this,R.layout.textview,items);
	        ListView list = (ListView)findViewById(R.id.undirectedList);
	        list.setAdapter(adapter);
	        
	        list.setOnItemClickListener(new OnItemClickListener(){

				@Override
				public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
						long arg3) {
					// TODO Auto-generated method stub
					Intent intent;
					
					switch(arg2){
					case 0:
						intent = new Intent(undirected.this,undDF.class);
						startActivity(intent);
						break;
					case 1:
						intent = new Intent(undirected.this,undBF.class);
						startActivity(intent);
						break;
					case 2:
						intent = new Intent(undirected.this,undDijkstra.class);
						startActivity(intent);
						break;
					case 3:
						intent = new Intent(undirected.this,undMST.class);
						startActivity(intent);
						break;
					}
				}
	        	
	        });
	    }
}
